LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/framework/factories - Pane.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 70 0.0 %
Date: 2012-12-27 Functions: 0 17 0.0 %
Legend: Lines: hit not hit

          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             : 
      21             : #include "framework/Pane.hxx"
      22             : 
      23             : #include <vcl/svapp.hxx>
      24             : #include <osl/mutex.hxx>
      25             : #include <toolkit/helper/vclunohelper.hxx>
      26             : #include <vcl/window.hxx>
      27             : #include <cppcanvas/vclfactory.hxx>
      28             : #include <comphelper/servicehelper.hxx>
      29             : 
      30             : using namespace ::com::sun::star;
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::drawing::framework;
      33             : 
      34             : using ::rtl::OUString;
      35             : 
      36             : namespace sd { namespace framework {
      37             : 
      38           0 : Pane::Pane (
      39             :     const Reference<XResourceId>& rxPaneId,
      40             :     ::Window* pWindow)
      41             :     throw ()
      42             :     : PaneInterfaceBase(MutexOwner::maMutex),
      43             :       mxPaneId(rxPaneId),
      44             :       mpWindow(pWindow),
      45           0 :       mxWindow(VCLUnoHelper::GetInterface(pWindow))
      46             : {
      47           0 : }
      48             : 
      49             : 
      50             : 
      51             : 
      52           0 : Pane::~Pane (void)
      53             : {
      54           0 : }
      55             : 
      56             : 
      57             : 
      58             : 
      59           0 : void Pane::disposing (void)
      60             : {
      61           0 :     mxWindow = NULL;
      62           0 :     mpWindow = NULL;
      63           0 : }
      64             : 
      65             : 
      66             : 
      67             : 
      68           0 : ::Window* Pane::GetWindow (void)
      69             : {
      70           0 :     if (mxWindow.is())
      71           0 :         return mpWindow;
      72             :     else
      73           0 :         return NULL;
      74             : }
      75             : 
      76             : 
      77             : 
      78             : 
      79             : //----- XPane -----------------------------------------------------------------
      80             : 
      81           0 : Reference<awt::XWindow> SAL_CALL Pane::getWindow (void)
      82             :     throw (RuntimeException)
      83             : {
      84           0 :     ThrowIfDisposed();
      85             : 
      86           0 :     return mxWindow;
      87             : }
      88             : 
      89             : 
      90             : 
      91             : 
      92           0 : Reference<rendering::XCanvas> SAL_CALL Pane::getCanvas (void)
      93             :     throw (RuntimeException)
      94             : {
      95           0 :     ::osl::MutexGuard aGuard (maMutex);
      96           0 :     ThrowIfDisposed();
      97             : 
      98           0 :     if ( ! mxCanvas.is())
      99           0 :         mxCanvas = CreateCanvas();
     100             : 
     101           0 :     return mxCanvas;
     102             : }
     103             : 
     104             : 
     105             : 
     106             : 
     107             : //----- XPane2 ----------------------------------------------------------------
     108             : 
     109           0 : sal_Bool SAL_CALL Pane::isVisible (void)
     110             :     throw (RuntimeException)
     111             : {
     112           0 :     ThrowIfDisposed();
     113             : 
     114           0 :     const ::Window* pWindow = GetWindow();
     115           0 :     if (pWindow != NULL)
     116           0 :         return pWindow->IsVisible();
     117             :     else
     118           0 :         return false;
     119             : }
     120             : 
     121             : 
     122             : 
     123             : 
     124           0 : void SAL_CALL Pane::setVisible (sal_Bool bIsVisible)
     125             :     throw (RuntimeException)
     126             : {
     127           0 :     ThrowIfDisposed();
     128             : 
     129           0 :     ::Window* pWindow = GetWindow();
     130           0 :     if (pWindow != NULL)
     131           0 :         pWindow->Show(bIsVisible);
     132           0 : }
     133             : 
     134             : 
     135             : 
     136             : 
     137           0 : Reference<css::accessibility::XAccessible> SAL_CALL Pane::getAccessible (void)
     138             :     throw (RuntimeException)
     139             : {
     140           0 :     ThrowIfDisposed();
     141           0 :     ::Window* pWindow = GetWindow();
     142           0 :     if (pWindow != NULL)
     143           0 :         return pWindow->GetAccessible(sal_False);
     144             :     else
     145           0 :         return NULL;
     146             : }
     147             : 
     148             : 
     149             : 
     150             : 
     151           0 : void SAL_CALL Pane::setAccessible (
     152             :     const Reference<css::accessibility::XAccessible>& rxAccessible)
     153             :     throw (RuntimeException)
     154             : {
     155           0 :     ThrowIfDisposed();
     156           0 :     ::Window* pWindow = GetWindow();
     157           0 :     if (pWindow != NULL)
     158           0 :         pWindow->SetAccessible(rxAccessible);
     159           0 : }
     160             : 
     161             : 
     162             : 
     163             : 
     164             : //----- XResource -------------------------------------------------------------
     165             : 
     166           0 : Reference<XResourceId> SAL_CALL Pane::getResourceId (void)
     167             :     throw (RuntimeException)
     168             : {
     169           0 :     ThrowIfDisposed();
     170             : 
     171           0 :     return mxPaneId;
     172             : }
     173             : 
     174             : 
     175             : 
     176             : 
     177           0 : sal_Bool SAL_CALL Pane::isAnchorOnly (void)
     178             :     throw (RuntimeException)
     179             : {
     180           0 :     return true;
     181             : }
     182             : 
     183             : 
     184             : 
     185             : 
     186             : //----- XUnoTunnel ------------------------------------------------------------
     187             : 
     188             : namespace
     189             : {
     190             :     class thePaneUnoTunnelId : public rtl::Static< UnoTunnelIdInit, thePaneUnoTunnelId > {};
     191             : }
     192             : 
     193           0 : const Sequence<sal_Int8>& Pane::getUnoTunnelId (void)
     194             : {
     195           0 :     return thePaneUnoTunnelId::get().getSeq();
     196             : }
     197             : 
     198           0 : sal_Int64 SAL_CALL Pane::getSomething (const Sequence<sal_Int8>& rId)
     199             :     throw (RuntimeException)
     200             : {
     201           0 :     sal_Int64 nResult = 0;
     202             : 
     203           0 :     if (rId.getLength() == 16
     204           0 :         && memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
     205             :     {
     206           0 :         nResult = reinterpret_cast<sal_Int64>(this);
     207             :     }
     208             : 
     209           0 :     return nResult;
     210             : }
     211             : 
     212             : 
     213             : 
     214             : 
     215             : //-----------------------------------------------------------------------------
     216             : 
     217           0 : Reference<rendering::XCanvas> Pane::CreateCanvas (void)
     218             :     throw (RuntimeException)
     219             : {
     220           0 :     Reference<rendering::XCanvas> xCanvas;
     221             : 
     222           0 :     if (mpWindow != NULL)
     223             :     {
     224             :         ::cppcanvas::SpriteCanvasSharedPtr pCanvas (
     225           0 :             ::cppcanvas::VCLFactory::getInstance().createSpriteCanvas(*mpWindow));
     226           0 :         if (pCanvas.get() != NULL)
     227           0 :             xCanvas = Reference<rendering::XCanvas>(pCanvas->getUNOSpriteCanvas(), UNO_QUERY);
     228             :     }
     229             : 
     230           0 :     return xCanvas;
     231             : }
     232             : 
     233             : 
     234             : 
     235             : 
     236           0 : void Pane::ThrowIfDisposed (void) const
     237             :     throw (lang::DisposedException)
     238             : {
     239           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     240             :     {
     241             :         throw lang::DisposedException ("Pane object has already been disposed",
     242           0 :             const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
     243             :     }
     244           0 : }
     245             : 
     246             : 
     247             : } } // end of namespace sd::framework
     248             : 
     249             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10