fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / unoobj / forbiuno.cxx
blobc6fe2d438d9b740441351a0b8be3d4e8c3ec6022
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <editeng/forbiddencharacterstable.hxx>
22 #include "forbiuno.hxx"
23 #include "docsh.hxx"
25 using namespace ::com::sun::star;
27 static rtl::Reference<SvxForbiddenCharactersTable> lcl_GetForbidden( ScDocShell* pDocSh )
29 rtl::Reference<SvxForbiddenCharactersTable> xRet;
30 if ( pDocSh )
32 ScDocument& rDoc = pDocSh->GetDocument();
33 xRet = rDoc.GetForbiddenCharacters();
34 if ( !xRet.is() )
36 // create an empty SvxForbiddenCharactersTable for SvxUnoForbiddenCharsTable,
37 // so changes can be stored.
39 xRet = new SvxForbiddenCharactersTable( comphelper::getProcessComponentContext() );
40 rDoc.SetForbiddenCharacters( xRet );
43 return xRet;
46 ScForbiddenCharsObj::ScForbiddenCharsObj( ScDocShell* pDocSh ) :
47 SvxUnoForbiddenCharsTable( lcl_GetForbidden( pDocSh ) ),
48 pDocShell( pDocSh )
50 if (pDocShell)
51 pDocShell->GetDocument().AddUnoObject(*this);
54 ScForbiddenCharsObj::~ScForbiddenCharsObj()
56 SolarMutexGuard g;
58 if (pDocShell)
59 pDocShell->GetDocument().RemoveUnoObject(*this);
62 void ScForbiddenCharsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
64 const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
65 if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING )
67 pDocShell = NULL; // document gone
71 void ScForbiddenCharsObj::onChange()
73 if (pDocShell)
75 pDocShell->GetDocument().SetForbiddenCharacters( mxForbiddenChars );
76 pDocShell->PostPaintGridAll();
77 pDocShell->SetDocumentModified();
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */