1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_XMLOFF_XMLPAGEEXPORT_HXX
21 #define INCLUDED_XMLOFF_XMLPAGEEXPORT_HXX
22 
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <sal/types.h>
26 #include <rtl/ustring.hxx>
27 #include <vector>
28 #include <rtl/ref.hxx>
29 #include <salhelper/simplereferenceobject.hxx>
30 #include <com/sun/star/uno/Reference.hxx>
31 
32 namespace com { namespace sun { namespace star {
33     namespace style { class XStyle; }
34     namespace container { class XNameAccess;}
35     namespace beans { class XPropertySet; }
36 } } }
37 
38 class SvXMLExport;
39 class XMLPropertyHandlerFactory;
40 class XMLPropertySetMapper;
41 class SvXMLExportPropertyMapper;
42 
43 
44 struct XMLPageExportNameEntry
45 {
46     OUString         sPageMasterName;
47     OUString         sStyleName;
48 };
49 
50 
51 class XMLOFF_DLLPUBLIC XMLPageExport : public salhelper::SimpleReferenceObject
52 {
53     SvXMLExport& rExport;
54 
55     css::uno::Reference< css::container::XNameAccess > xPageStyles;
56 
57     ::std::vector< XMLPageExportNameEntry > aNameVector;
58     SAL_DLLPRIVATE bool findPageMasterName( const OUString& rStyleName, OUString& rPMName ) const;
59 
60     rtl::Reference < XMLPropertyHandlerFactory > xPageMasterPropHdlFactory;
61     rtl::Reference < XMLPropertySetMapper > xPageMasterPropSetMapper;
62     rtl::Reference < SvXMLExportPropertyMapper > xPageMasterExportPropMapper;
63 
64 protected:
65 
GetExport()66     SvXMLExport& GetExport() { return rExport; }
67 
68     void collectPageMasterAutoStyle(
69                 const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
70                 OUString& rPageMasterName );
71 
72     virtual void exportMasterPageContent(
73                 const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
74                  bool bAutoStyles );
75 
76     bool exportStyle(
77                 const css::uno::Reference< css::style::XStyle >& rStyle,
78                 bool bAutoStyles );
79 
80     void exportStyles( bool bUsed, bool bAutoStyles );
81 
82 public:
83     XMLPageExport( SvXMLExport& rExp );
84     virtual ~XMLPageExport() override;
85 
collectAutoStyles(bool bUsed)86     void    collectAutoStyles( bool bUsed )     { exportStyles( bUsed, true ); }
87     void    exportAutoStyles();
exportMasterStyles(bool bUsed)88     void    exportMasterStyles( bool bUsed )    { exportStyles( bUsed, false ); }
89 
90     //text grid enhancement for better CJK support
91     void exportDefaultStyle();
92 };
93 
94 #endif // INCLUDED_XMLOFF_XMLPAGEEXPORT_HXX
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
97