]> git.lyx.org Git - features.git/commitdiff
Fix bug #9236: After we recreate the DocumentClass, we have to apply
authorRichard Heck <rgheck@lyx.org>
Wed, 6 Aug 2014 15:43:22 +0000 (11:43 -0400)
committerRichard Heck <rgheck@lyx.org>
Thu, 7 Aug 2014 19:13:31 +0000 (15:13 -0400)
it to the document.

src/frontends/qt4/GuiApplication.cpp

index 660b1223291683b02d91645018e5c5cb073f0382..f1c2e90cc661b07dc430e8e613b54fe8251d25a4 100644 (file)
 
 #include "Buffer.h"
 #include "BufferList.h"
+#include "BufferParams.h"
 #include "BufferView.h"
 #include "CmdDef.h"
 #include "Color.h"
+#include "CutAndPaste.h"
+#include "ErrorList.h"
 #include "Font.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
@@ -54,6 +57,8 @@
 #include "Thesaurus.h"
 #include "version.h"
 
+#include "insets/InsetText.h"
+
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
@@ -1915,7 +1920,16 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                istringstream ss(argument);
                Lexer lex;
                lex.setStream(ss);
+               
+               // See #9236
+               // We need to make sure that, after we recreat the DocumentClass, 
+               // which we do in readHeader, we apply it to the document itself.
+               DocumentClassConstPtr olddc = defaults.params().documentClassPtr();
                int const unknown_tokens = defaults.readHeader(lex);
+               DocumentClassConstPtr newdc = defaults.params().documentClassPtr();
+               ErrorList el;
+               InsetText & theinset = static_cast<InsetText &>(defaults.inset());
+               cap::switchBetweenClasses(olddc, newdc, theinset, el);
 
                if (unknown_tokens != 0) {
                        lyxerr << "Warning in LFUN_BUFFER_SAVE_AS_DEFAULT!\n"