Line data Source code
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 : #include <svx/svdoutl.hxx>
21 : #include <editeng/outliner.hxx>
22 : #include <svx/svdotext.hxx>
23 : #include <editeng/editstat.hxx>
24 : #include <svx/svdmodel.hxx>
25 : #include <editeng/eeitem.hxx>
26 : #include <svl/itempool.hxx>
27 :
28 :
29 0 : SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
30 : : Outliner( pItemPool, nMode ),
31 : //mpPaintInfoRec( NULL )
32 0 : mpVisualizedPage(0)
33 : {
34 0 : }
35 :
36 :
37 0 : SdrOutliner::~SdrOutliner()
38 : {
39 0 : }
40 :
41 :
42 0 : void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
43 : {
44 0 : if( pObj && pObj != mpTextObj.get() )
45 : {
46 0 : SetUpdateMode(false);
47 0 : sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
48 0 : if ( !pObj->IsOutlText() )
49 0 : nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
50 0 : Init( nOutlinerMode2 );
51 :
52 0 : SetGlobalCharStretching(100,100);
53 :
54 0 : sal_uIntPtr nStat = GetControlWord();
55 0 : nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
56 0 : SetControlWord(nStat);
57 :
58 0 : Size aNullSize;
59 0 : Size aMaxSize( 100000,100000 );
60 0 : SetMinAutoPaperSize( aNullSize );
61 0 : SetMaxAutoPaperSize( aMaxSize );
62 0 : SetPaperSize( aMaxSize );
63 0 : ClearPolygon();
64 : }
65 :
66 0 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
67 0 : }
68 :
69 0 : void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
70 : {
71 0 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
72 0 : }
73 :
74 0 : OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
75 : Color*& rpTxtColor, Color*& rpFldColor)
76 : {
77 0 : bool bOk = false;
78 0 : OUString aRet;
79 :
80 0 : if(mpTextObj.is())
81 0 : bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
82 :
83 0 : if (!bOk)
84 0 : aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
85 :
86 0 : return aRet;
87 : }
88 :
89 0 : const SdrTextObj* SdrOutliner::GetTextObj() const
90 : {
91 0 : if( mpTextObj.is() )
92 0 : return static_cast< SdrTextObj* >( mpTextObj.get() );
93 : else
94 0 : return 0;
95 : }
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|