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 : DBG_NAME(SdrOutliner)
29 :
30 3225 : SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
31 : : Outliner( pItemPool, nMode ),
32 : //mpPaintInfoRec( NULL )
33 3225 : mpVisualizedPage(0)
34 : {
35 : DBG_CTOR(SdrOutliner,NULL);
36 3225 : }
37 :
38 :
39 5663 : SdrOutliner::~SdrOutliner()
40 : {
41 : DBG_DTOR(SdrOutliner,NULL);
42 5663 : }
43 :
44 :
45 26054 : void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
46 : {
47 26054 : if( pObj && pObj != mpTextObj.get() )
48 : {
49 5669 : SetUpdateMode(sal_False);
50 5669 : sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
51 5669 : if ( !pObj->IsOutlText() )
52 5507 : nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
53 5669 : Init( nOutlinerMode2 );
54 :
55 5669 : SetGlobalCharStretching(100,100);
56 :
57 5669 : sal_uIntPtr nStat = GetControlWord();
58 5669 : nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
59 5669 : SetControlWord(nStat);
60 :
61 5669 : Size aNullSize;
62 5669 : Size aMaxSize( 100000,100000 );
63 5669 : SetMinAutoPaperSize( aNullSize );
64 5669 : SetMaxAutoPaperSize( aMaxSize );
65 5669 : SetPaperSize( aMaxSize );
66 5669 : ClearPolygon();
67 : }
68 :
69 26054 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
70 26054 : }
71 :
72 1134 : void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
73 : {
74 1134 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
75 1134 : }
76 :
77 388 : XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
78 : Color*& rpTxtColor, Color*& rpFldColor)
79 : {
80 388 : bool bOk = false;
81 388 : XubString aRet;
82 :
83 388 : if(mpTextObj.is())
84 388 : bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, sal_False, rpTxtColor, rpFldColor, aRet);
85 :
86 388 : if (!bOk)
87 388 : aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
88 :
89 388 : return aRet;
90 : }
91 :
92 15422 : const SdrTextObj* SdrOutliner::GetTextObj() const
93 : {
94 15422 : if( mpTextObj.is() )
95 388 : return static_cast< SdrTextObj* >( mpTextObj.get() );
96 : else
97 15034 : return 0;
98 : }
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|